from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone

from core.models import BaseModel
from account.models import Account


# 首页轮播图
class Banner(BaseModel):
    image           = models.ImageField('轮播图', upload_to = 'banner/')

    CATEGORIES = (
        ('empty', '单图片'),
        ('url', '网址链接'),
        ('weapp', '小程序链接'),
        ('diy', 'DIY详情'),
        ('copy', '复制内容'),
        ('contact', '联系客服'),
    )
    category        = models.CharField('类别', max_length = 128, default = 'empty', choices = CATEGORIES)

    content         = models.TextField('内容', blank = True, null = True)

    order           = models.IntegerField('排序', default = 0)

    start_time      = models.DateTimeField('开始时间', blank = True, null = True)

    end_time        = models.DateTimeField('结束时间', blank = True, null = True)

    class Meta:
        verbose_name = "轮播图管理"
        verbose_name_plural = "轮播图管理"
